from django.db import models

# Create your models here.

class BaseMode(models.Model):
    create_time = models.DateTimeField(auto_now_add=True,verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True,verbose_name='更新时间')
    class Meta:
        abstract=True  # 它是一个抽象类,默认允许下面类继承它

#用户模块   (用户表,区域表,用户地址表)

#用户表
# class Users(BaseMode):
#     username = models.CharField(max_length=50)
#     password = models.CharField(max_length=300)
#     phone = models.CharField(max_length=11)
#     class Meta:
#         db_table = 'users'
#
# #区域表
# class Area(BaseMode):
#     name = models.CharField(max_length=100)
#     pid = models.ForeignKey('self',on_delete=models.SET_NULL,null=True,blank=True)
#
# #用户地址表
# class Uaddress(BaseMode):
#     users = models.ForeignKey(Users,models.CASCADE)
#     area = models.ForeignKey(Area,models.CASCADE)


#其他  (新闻、广告表)
#新闻表
class Journalism(BaseMode):
    headline = models.CharField(max_length=50,verbose_name='标题')
    content = models.TextField(default='',verbose_name='内容')
    class Meta:
        db_table = 'journalism'

#广告表
class Advertising(BaseMode):
    pic = models.ImageField(default='',verbose_name='图片')
    urls = models.CharField(max_length=200, verbose_name='跳转地址')
    type = models.IntegerField(verbose_name='类型')#1为轮播图   2为右边小图

    class Meta:
        db_table = 'advertising'

